<template>
  <div class="colleBox">
    <!-- 我的收藏页面 -->
    <div class="colleTitle">我的收藏</div>
    <ul>
      <li class="colleLi" v-for="(item, index) in colleList" :key="index">
        <input type="checkbox" @click="choose(item,item.id)" />
        <span>{{ item.topic }}</span>
        <span>{{ item.title }}</span>
        <span>{{ item.date }}</span>
        <span @click="del(colleArr)">删除</span>
      </li>
      <div class="colleFun">
        <input type="checkbox" />全选
        <button>删除全部收藏</button>
      </div>
    </ul>
  </div>
</template>

<script>
import api from '../../api'
export default {
  data() {
    return {
      colleFlag:false,
      colleArr:[],
      colleList: [
        /* {
          id:2001,
          topic: "聊聊",
          title: "臭氧也算大气污染物么？",
          date: "50分钟前",
        },
        {
          id:2002,
          topic: "聊聊",
          title: "臭氧也算大气污染物么？",
          date: "2小时前",
        },
        {
          id:2003,
          topic: "聊聊",
          title: "臭氧也算大气污染物么？",
          date: "5小时前",
        }, */
      ],
    };
  },
  methods:{
    choose(obj,id){
      console.log(obj,id);
      //console.log(obj);
      this.colleArr.push(obj)
    },
    del(arr){
      console.log(arr);
    }
  },
  mounted(){
    api.getMycomment().then(res => {
      console.log(res);
      this.colleList=res.data.list
    })
  }
};
</script>

<style>
.colleBox {
  width: 900px;
  height: 780px;
  background: #fff;
}
.colleTitle {
  padding-left: 50px;
  width: 850px;
  height: 50px;
  text-align: left;
  border-bottom: 1px solid #ccc;
  line-height: 50px;
  color: #999;
}
.colleLi {
  padding: 15px;
  height: 30px;
  line-height: 30px;
  text-align: left;
  margin: 0 15px;
  width: 840px;
  border-bottom: 1px solid #ccc;
}
.colleLi > input {
  margin-right: 10px;
}
.colleLi > span:first-of-type {
  display: inline-block;
  width: 50px;
  height: 20px;
  text-align: left;
  border-right: 2px solid #000;
  line-height: 20px;
  margin-right: 10px;
  font-weight: 700;
}
.colleLi > span:nth-of-type(2) {
  display: inline-block;
  width: 250px;
}
.colleLi > span:nth-of-type(3) {
  display: inline-block;
  width: 100px;
  color: #999;
}
.colleLi > span:last-child {
  display: inline-block;
  float: right;
}
.colleFun{
    padding:15px 30px;
    text-align: left;
}
.colleFun>button{
    margin-left: 50px;
    width: 150px;
    height: 30px;
}
</style>